package com.jcompressor.model.config;

import java.io.Serializable;

import org.apache.commons.lang.StringUtils;

import com.jcompressor.JcompressorContext;

public class Property implements Serializable {
	
    private static final long serialVersionUID = -3383304927378225771L;
    
	private String key;
	private String value;
	
	public String getKey() {
		return this.key;
	}
	
	public String getValue() {
		return JcompressorContext.getConfigurator().getPropertyExpander().expandProperties(this.value);
	}
	
	public void setKey(final String key) {
		this.key = key;
	}
	
	public void setValue(final String value) {
		this.value = value;
	}
	
	@Override
	public boolean equals(final Object obj) {
		if (this == obj) {
			return true;
		}
		
		if (obj == null) {
			return false;
		}
		
		if (!(obj instanceof Property)) {
			return false;
		}
		
		final Property property = (Property)obj;
		if (StringUtils.equals(property.getKey(), this.getKey())) {
			return true;
		}
		
		return false;
	}
	
}